module("Assert: with asserts on");

test("Assert.fail ", function() {
	Assert.assertsOn();
	throws(function() {
		Assert.fail("this is a failure.");
	}, AssertionError, "Expect this to throw an error");
});

test("Assert.assertNotNull", function() {
	Assert.assertsOn();
	throws(function() {
		var nullObject;
		Assert.assertNotNull(nullObject, "object can't be null.");
	}, AssertionError, "Expect this to throw an error");
	throws(function() {
		var nullObject = null;
		Assert.assertNotNull(nullObject, "object can't be null.");
	}, AssertionError, "Expect this to throw an error");

	noThrow(function() {
		var notNullObject = "foo";
		Assert.assertNotNull(notNullObject, "object can't be null.");
	});

	noThrow(function() {
		var notNullObject = 1234;
		Assert.assertNotNull(notNullObject, "object can't be null.");
	});

	noThrow(function() {
		var notNullObject = {
			"foo" : 'bar'
		};
		Assert.assertNotNull(notNullObject, "object can't be null.");
	});

	noThrow(function() {
		var notNullObject = {};
		Assert.assertNotNull(notNullObject, "object can't be null.");
	});

});

test("Assert.assertNotEquals", function() {
	Assert.assertsOn();
	throws(function() {
		var a = 1;
		var b = 1;
		Assert.assertNotEquals(a, b, "unequal objects.");
	}, AssertionError, "Expect this to throw an error");

	throws(function() {
		var a = "foo";
		var b = "foo";
		Assert.assertNotEquals(a, b, "unequal objects.");
	}, AssertionError, "Expect this to throw an error");

	throws(function() {
		var a = {
			"foo" : "bar"
		};
		var b = a;
		Assert.assertNotEquals(a, b, "unequal objects.");
	}, AssertionError, "Expect this to throw an error");

	throws(function() {
		var a = {
			"foo" : "bar"
		};
		var b = {
			"foo" : "bar"
		};
		Assert.assertNotEquals(a, b, "unequal objects.");
	}, AssertionError, "Expect this to throw an error");

	noThrow(function() {
		var a = {
			"foo" : "bar"
		};
		var b = {
			"foo" : "b"
		};
		Assert.assertNotEquals(a, b, "unequal objects.");
	}, "objects are unequal");
	noThrow(function() {
		var a = {
			"foo" : "bar"
		};
		var b = {
			"baz" : "bar"
		};
		Assert.assertNotEquals(a, b, "unequal objects.");
	}, "objects are unequal");

});

test("Assert.assertEquals", function() {
	Assert.assertsOn();
	noThrow(function() {
		var a = 1;
		var b = 1;
		Assert.assertEquals(a, b, "unequal objects.");
	}, AssertionError, "Expect this to throw an error");

	noThrow(function() {
		var a = "foo";
		var b = "foo";
		Assert.assertEquals(a, b, "unequal objects.");
	}, AssertionError, "Expect this to throw an error");

	noThrow(function() {
		var a = {
			"foo" : "bar"
		};
		var b = a;
		Assert.assertEquals(a, b, "unequal objects.");
	}, AssertionError, "Expect this to throw an error");

	noThrow(function() {
		var a = {
			"foo" : "bar"
		};
		var b = {
			"foo" : "bar"
		};
		Assert.assertEquals(a, b, "unequal objects.");
	}, AssertionError, "Expect this to throw an error");

	throws(function() {
		var a = {
			"foo" : "bar"
		};
		var b = {
			"foo" : "b"
		};
		Assert.assertEquals(a, b, "unequal objects.");
	}, "objects are unequal");

	throws(function() {
		var a = {
			"foo" : "bar"
		};
		var b = {
			"baz" : "bar"
		};
		Assert.assertEquals(a, b, "unequal objects.");
	}, "objects are unequal");
});

